from sqlalchemy import Column,Integer,String,Text,Boolean,TIMESTAMP
from sqlalchemy.sql import func
from api_tools.database import Base

class Note(Base):
    __tablename__ = "notes"
    id = Column(Integer, primary_key=True, index=True)
    user_id = Column(Integer, nullable=False)
    category =  Column(String(50), nullable=False)
    title = Column(String(255), nullable=False)
    content = Column(Text, nullable=False)
    is_published = Column(Boolean, server_default='0', nullable=False)
    created_at = Column(TIMESTAMP, server_default=func.now(), nullable=False)
    # updated_at = Column(TIMESTAMP, server_default=func.now(), onupdate=func.now(), nullable=True)

class User(Base):
    __tablename__ = "users"
    id = Column(Integer, primary_key=True, index=True)
    username = Column(String(50), nullable=False)
    password = Column(String(255), nullable=False)
    created_at = Column(TIMESTAMP, server_default=func.now(), nullable=False)
    # updated_at = Column(TIMESTAMP, server_default=func.now(), onupdate=func.now(), nullable=True)
